﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using DataLibs;

namespace httpGetter {
    public class httpGetter {

        #region Options

        static string _userAget = "user-agent";
        static string _userAgetInfo = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2;)";

        public static string UserAget {
            get { return _userAget; }
            set { _userAget = value; }
        }

        public static string UserAgetInfo {
            get { return _userAgetInfo; }
            set { _userAgetInfo = value; }
        }
        #endregion

        Uri uri;

        public httpGetter(Uri uri) {
            this.uri = uri;
        }

        public httpGetter(string url) {
            uri = new Uri(url);
        }

        public htmlData getDataViaHTTP () {
            
            WebClient client = new WebClient();
            client.Headers.Add(_userAget, _userAgetInfo);
            
            return new htmlData(client.DownloadString(uri),uri.ToString());
        }

    }
}
